# -*- coding: utf-8 -*-
"""
Created on Sat Oct 06 11:52:07 2012

@author: Tomek
"""
import namespace

def writeClass(c):
    print ("CLASS")
    print (c["name"])
    for x in c["public"]["classes"]:
        writeClass(x)
    for x in c["protected"]["classes"]:
        writeClass(x)
    for x in c["private"]["classes"]:
        writeClass(x)
    print ("ENDCLS")
def writeNamespace(n):
    if n["name"]!="":
        print ("NAMESPACE")
        print (n["name"])
    for t in n["namespaces"]:
        writeNamespace(t)
    for t in n["classes"]:
        writeClass(t)
    for t in n["functions"]:
        if t["isOperator"]==False:
            print ("FUNCTION")
            print (t["name"])
    for t in n["enums"]:
        print ("ENUM")
        print (t["name"])
    if n["name"]!="":
        print ("ENDNS")
        
        
ns=namespace.loadNamespace("__ns__data__")
writeNamespace(ns)